package com.guandata.cdc;

import java.util.ArrayList;
import java.util.List;

public class ExecutionParameterBuilder {
    private static final String STD_PARAM_KEY_TEMPLATE = "--%s";

    private final List<String> paramCache;

    private ExecutionParameterBuilder() {
        this.paramCache = new ArrayList<>();
    }

    public static ExecutionParameterBuilder builder() {
        return new ExecutionParameterBuilder();
    }

    public ExecutionParameterBuilder option(String key, String value) {
        paramCache.add(String.format(STD_PARAM_KEY_TEMPLATE, key));
        paramCache.add(value);
        return this;
    }

    public String[] build() {
        return paramCache.toArray(new String[0]);
    }
}
